<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
  <template>
    <el-button plain @click="open2">成功</el-button>
    <el-button plain @click="open3">警告</el-button>
    <el-button plain @click="open1">消息</el-button>
    <el-button plain @click="open4">错误</el-button>
  </template>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
 let v = new Vue({
    el: '#app',
    data: function() {
      return {

      }
    },
   methods:{
     open1() {
       this.$message('这是一条消息提示');
     },
     open2() {
       // v.$message({
       //   message: '恭喜你，这是一条成功消息',
       //   type: 'success'
       // });
       //简写   此处的this代表当前的Vue对象  和  v变量作用相同
       v.$message.success("成功消息");
     },

     open3() {
       // this.$message({
       //   message: '警告哦，这是一条警告消息',
       //   type: 'warning'
       // });
       v.$message.warning("警告消息");
     },

     open4() {
       this.$message.error('错了哦，这是一条错误消息');
     }
   }
  })
</script>
</html>